import java.nio.file.Files
import java.nio.file.Paths

if (Files.exists(Paths.get(".dist"))) {
    System.err.println ".dist/ 已经存在，请确认无误并手动删除。"
} else {
    mkdirs(
            ".dist",
            ".dist/dep_files",
            ".dist/dep_resources"
    )
    new File(".dist/dep_resources/.gitignore").text = 'target/'
    new File(".dist/dep_resources.json").text = "" +
            "[\n" +
            "  {\n" +
            "    \"sourceFile\": \".dist/dep_resources/.gitignore\",\n" +
            "    \"targetFile\": \".gitignore\"\n" +
            "  }\n" +
            "]"
}

def mkdirs(String... dirs) {
    dirs.each {
        new File(it).mkdir()
    }
}